package com.csw.springd.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;

@Controller
public class LoginController {
    @RequestMapping(value = "/user/login", method = RequestMethod.POST)
    public String toLogin(@RequestParam("username") String username,
                          String password, HttpServletRequest request) {
        System.out.println("----enter----");
        request.getSession().setAttribute("loginName",username);
        return "test/study";
    }
}
